package com.aspose.cells.a.d;

import java.util.HashMap;

public class zas extends HashMap {
   private boolean a;
   private long b = 0L;

   public zas(boolean var1) {
      this.a = var1;
   }

   public zbh a(long var1) {
      return super.containsKey(var1) ? (zbh)com.aspose.cells.b.a.zl.a(super.get(var1), zbh.class) : null;
   }

   public void a(zbh var1) throws Exception {
      long var4;
      if (this.a) {
         if (super.size() <= 19) {
            int var2 = this.b++;
            var4 = var2 | 2147483648L;
            var1.a(var4);
         } else {
            var4 = var1.b();
         }
      } else if (var1 == null) {
         var4 = (long)(this.b++);
      } else {
         var4 = this.a();
      }

      super.put(var4, var1);
   }

   public void b(long var1) {
      if (this.a) {
         if ((var1 & 4294967295L & 2147483648L) == 2147483648L) {
            return;
         }

         super.remove(var1);
      } else {
         super.put(var1, (Object)null);
      }

   }

   private long a() throws Exception {
      for(long var1 = 0L; (var1 & 4294967295L) < (long)super.size(); ++var1) {
         if (!super.containsKey(var1)) {
            throw new Exception("WMF Objects find slot error");
         }

         if (super.get(var1) == null) {
            return var1;
         }
      }

      throw new Exception("Object count is out of range.");
   }
}
